package com.xiexie.seckill.controller;


import com.xiexie.seckill.pojo.User;
import com.xiexie.seckill.rabbitMQ.RabbitMQSender;
import com.xiexie.seckill.vo.RespBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 前端控制器
 *
 * @author xiexie
 * @date 2021-07-30
 */
@Controller
@RequestMapping("/user")
public class UserController {

    @Autowired
    private RabbitMQSender rabbitMQSender;

    @RequestMapping("/info")
    @ResponseBody
    public RespBean userInfo(User user) {
        return RespBean.success(user);
    }


    /**
     * 测试发送rabbitMQ
     */
    @RequestMapping("/mqsent")
    @ResponseBody
    public void mqsent() {
        rabbitMQSender.sent("hello rabbitMQ");
    }
}
